class SceneTitle extends GuaScene {
    constructor(game) {
        super(game)
        self.game = game

        this.game.scene = this
        this.setUp()
        this.setInputs()

    }
    setUp() {
        var bg = GuaImage.new(this.game, 'bg')
        this.addElement(bg)

        var ground = new Ground(this.game)
        this.addElement(ground)

        var bird = new Bird(this.game)
        this.bird = bird
        bird.setPosition(110, 180)
        this.addElement(bird)
    }

    setInputs() {
        var self = this
        // self.game.registerAction('d', function(keyStatus) {
        //     self.bird.run(+9, keyStatus)
        // })
        // self.game.registerAction('a', function(keyStatus) {
        //     self.bird.run(-7, keyStatus)
        // })
        self.game.registerAction('j', function(keyStatus) {
            let s = new Scene(self.game)
            self.game.addScene('main', s)
            self.game.runWithScene('main')
        })
    }

    draw() {
        super.draw()
            // this.game.context.strokeText('开始游戏', 20, 250)
    }

    update() {
        super.update()
        log("title update")
        this.bird.setPosition(110, 180)
        this.bird.rotation = 0
    }

}